package com.lxitedu.chain.processor;

import com.lxitedu.utils.Context;
import com.lxitedu.utils.LxitException;

public abstract class Chain {
  private Chain next;

  public void setNext(Chain next) {
    this.next = next;
  }

  public Chain getNext() {
    return next;
  }

  public abstract void process(Context context) throws LxitException;

  protected void processNext(Context context) throws LxitException {
    if (next != null) {
      next.process(context);
    }
  }
}
